import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AdmAssetRepairVO, AdmAssetRepairForm, AdmAssetRepairQuery } from '@/api/general/administration/asset/repair/types';

/**
 * 查询物资维修申请列表
 * @param query
 * @returns {*}
 */

export const listAdmAssetRepair = (query?: AdmAssetRepairQuery): AxiosPromise<AdmAssetRepairVO[]> => {
  return request({
    url: '/system/admAssetRepair/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询物资维修申请详细
 * @param id
 */
export const getAdmAssetRepair = (id: string | number): AxiosPromise<AdmAssetRepairVO> => {
  return request({
    url: '/system/admAssetRepair/' + id,
    method: 'get'
  });
};

/**
 * 新增物资维修申请
 * @param data
 */
export const addAdmAssetRepair = (data: AdmAssetRepairForm) => {
  return request({
    url: '/system/admAssetRepair',
    method: 'post',
    data: data
  });
};

/**
 * 修改物资维修申请
 * @param data
 */
export const updateAdmAssetRepair = (data: AdmAssetRepairForm) => {
  return request({
    url: '/system/admAssetRepair',
    method: 'put',
    data: data
  });
};

/**
 * 删除物资维修申请
 * @param id
 */
export const delAdmAssetRepair = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/admAssetRepair/' + id,
    method: 'delete'
  });
};
